{% load namedqueryset_tags %}
{% for column in filter.columns %}
<td>
  {% ifequal column.ordering ordering %}
    {% if descending %}
      <a class="selected"
         href="{% set_url_param filter.params.order column.ordering %}"
      >{{column.display|escape}}<span class="sort_down">&nbsp;</span></a>
    {% else %}
      <a class="selected"
         href="{% set_url_param filter.params.order column.reversed %}"
      >{{column.display|escape}}<span class="sort_up">&nbsp;</span></a>
    {% endif %}
  {% else %}
      <a href="{% set_url_param filter.params.order column.ordering %}"
      >{{column.display|escape}}</a>
  {% endifequal %}
</td>
{% endfor %}
